package com.kun.portal.webframe.po;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import com.kun.portal.webframe.util.Loaded;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Target;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.util.Date;

@Entity
@Table(
        name = "fbo_gate_position_occupy_distribution",
        indexes = {@Index(
                columnList = "distribution_time",
                unique = true
        )}

)
public class GatePositionOccupyDistribution {
    @Id
    @GeneratedValue(
            generator = "gate_pod_Id"
    )
    @GenericGenerator(
            name = "gate_pod_Id",
            strategy = "uuid"
    )
    @Column(
            name = "gate_pod_Id",
            length = 32,
            nullable = false,
            updatable = false
    )
    private String gatePODId;
    @ManyToOne(targetEntity =FlightInfoPo.class  ,cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
    @JoinColumn(name = "flight_info_id", referencedColumnName = "flight_info_id",insertable = true,updatable = true)
    private FlightInfoPo flightInfoPo;
    @ManyToOne(targetEntity =GpConfigPo.class  ,cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
    @JoinColumn(name = "gp_Id", referencedColumnName = "gp_Id",insertable = true,updatable = true)
    private GpConfigPo gpConfigPo;
    @Column(
            name = "distribution_time"
    )
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="Asia/Shanghai")
    @Temporal(TemporalType.TIMESTAMP)
    private Date distributionTime;
    @Column(
            name = "occupy_time"
    )
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="Asia/Shanghai")
    @Temporal(TemporalType.TIMESTAMP)
    private Date occupyTime;
    @Column(
            name = "leave_time"
    )
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="Asia/Shanghai")
    @Temporal(TemporalType.TIMESTAMP)
    private Date leaveTime;

    public String getGatePODId() {
        return gatePODId;
    }

    public void setGatePODId(String gatePODId) {
        this.gatePODId = gatePODId;
    }

    public FlightInfoPo getFlightInfoPo() {
        return (FlightInfoPo) Loaded.loaded(flightInfoPo);
    }

    public void setFlightInfoPo(FlightInfoPo flightInfoPo) {
        this.flightInfoPo = flightInfoPo;
    }

    public GpConfigPo getGpConfigPo() {
        return null;
    }

    public void setGpConfigPo(GpConfigPo gpConfigPo) {
        this.gpConfigPo = gpConfigPo;
    }

    public Date getDistributionTime() {
        return distributionTime;
    }

    public void setDistributionTime(Date distributionTime) {
        this.distributionTime = distributionTime;
    }

    public Date getOccupyTime() {
        return occupyTime;
    }

    public void setOccupyTime(Date occupyTime) {
        this.occupyTime = occupyTime;
    }



    public Date getLeaveTime() {
        return leaveTime;
    }

    public void setLeaveTime(Date leaveTime) {
        this.leaveTime = leaveTime;
    }
}
